Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow 1-2 byte strings in the dictionary #354

Merged
merged 1 commit into from
Oct 1, 2023

Conversation

Jille
Copy link
Contributor

@Jille Jille commented Sep 25, 2023

Interning 1-2 byte strings isn't very useful because their binary format is longer / equal to simply encoding it as a string. So we shouldn't try to automatically intern those strings.

However, if someone adds such string to their dict, they probably want it interned anyway. (In my case to reduce allocations.)

After this change, people explicitly passing a dict with 1-2 byte entries will see different binary output from msgpack. Decoding keeps working. Automatic interning is unchanged.

Interning 1-2 byte strings isn't very useful because their binary format
is longer / equal to simply encoding it as a string. So we shouldn't try
to automatically intern those strings.

However, if someone adds such string to their dict, they probably want
it interned anyway. (In my case to reduce allocations.)

After this change, people explicitly passing a dict with 1-2 byte
entries will see different binary output from msgpack. Decoding keeps
working. Automatic interning is unchanged.
@vmihailenco vmihailenco merged commit 96ec1ea into vmihailenco:v5 Oct 1, 2023
@vmihailenco
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants